package com.fadadianqi.logistics.sell.dao.ibatis;

import com.fadadianqi.commons.GenericDAOSuport;
import com.fadadianqi.logistics.sell.dao.GoodsDAO;
import com.fadadianqi.logistics.sell.model.Goods;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component("billGoodsDAO")
public class GoodsDAOImpl extends GenericDAOSuport<String, Goods> implements GoodsDAO {

    @Override
    protected Class<?> getObjectClass() {
        return Goods.class;
    }

    @Override
    protected String getTableName() {
        return "bill_goods";
    }

    @Override
    public Goods getByBillIdAndGoodsId(String billId, String goodsId) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("billId", billId);
        map.put("goodsId", goodsId);
        return super.getByPropertys(map);
    }

    @Override
    public List<Goods> findGoodsByBillId(String billId) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("billId", billId);
        return super.findByPropertys(map);
    }
}
